package com.lance.answer.gui.answer.gk.answer.lms;

import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.jetbrains.annotations.NotNull;

import java.util.List;

/**
 *  "type": "online_video", 判断作业类型
 */
@NoArgsConstructor
@Data
public class Courseware {


    @JsonProperty("activities")
    private List<ActivitiesDTO> activities;
    @JsonProperty("end")
    private Long end;
    @JsonProperty("page")
    private Long page;
    @JsonProperty("page_size")
    private Long pageSize;
    @JsonProperty("pages")
    private Long pages;
    @JsonProperty("start")
    private Long start;
    @JsonProperty("total")
    private Long total;

    @NoArgsConstructor
    @Data
    public static class ActivitiesDTO {
        @JsonProperty("assign_group_ids")
        private List<?> assignGroupIds;
        @JsonProperty("assign_student_ids")
        private List<?> assignStudentIds;
        @JsonProperty("average_score")
        private Object averageScore;
        @JsonProperty("can_show_score")
        private Boolean canShowScore;
        @JsonProperty("completion_criterion")
        private String completionCriterion;
        @JsonProperty("completion_criterion_key")
        private String completionCriterionKey;
        @JsonProperty("completion_criterion_value")
        private String completionCriterionValue;
        @JsonProperty("course_id")
      //  private Long courseId;
        private Long courseId;
        @JsonProperty("created_at")
        private String createdAt;
        @JsonProperty("created_by")
        private CreatedByDTO createdBy;
        @JsonProperty("data")
        private DataDTO data;
        @JsonProperty("end_time")
        private Object endTime;
        @JsonProperty("from_master")
        private Boolean fromMaster;
        @JsonProperty("group_set_id")
        private Long groupSetId;
        @JsonProperty("group_set_name")
        private Object groupSetName;
        @JsonProperty("has_assign_group")
        private Boolean hasAssignGroup;
        @JsonProperty("has_assign_student")
        private Boolean hasAssignStudent;
        @JsonProperty("has_score_count")
        private Long hasScoreCount;
        @JsonProperty("highest_score")
        private Object highestScore;
        // FIXME 这个才是视频的ID！！！！！！！！！
        @JsonProperty("id")
      //  private Long id; FIXME 2022-4-21
        private Long id;
        @JsonProperty("imported_from")
        private String importedFrom;
        @JsonProperty("imported_track_id")
        private String importedTrackId;
        @JsonProperty("inter_review_named")
        private Object interReviewNamed;
        @JsonProperty("inter_score_map")
        private InterScoreMapDTO interScoreMap;
        @JsonProperty("interaction_activity_attributes")
        private Object interactionActivityAttributes;
        @JsonProperty("intra_rubric_id")
        private Long intraRubricId;
        @JsonProperty("intra_rubric_instance")
        private IntraRubricInstanceDTO intraRubricInstance;
        @JsonProperty("intra_rubric_instance_id")
        private Long intraRubricInstanceId;
        @JsonProperty("intra_score_map")
        private IntraScoreMapDTO intraScoreMap;
        @JsonProperty("is_assigned_to_all")
        private Boolean isAssignedToAll;
        @JsonProperty("is_closed")
        private Boolean isClosed;
        @JsonProperty("is_final")
        private Object isFinal;
        @JsonProperty("is_inter_review_by_submitter")
        private Object isInterReviewBySubmitter;
        @JsonProperty("is_open")
        private Boolean isOpen;
        @JsonProperty("is_opened_catalog")
        private Boolean isOpenedCatalog;
        @JsonProperty("is_started")
        private Boolean isStarted;
        @JsonProperty("is_submit_closed")
        private Object isSubmitClosed;
        @JsonProperty("last_updated_at")
        private String lastUpdatedAt;
        @JsonProperty("last_updated_by")
        private String lastUpdatedBy;
        @JsonProperty("late_submission_count")
        private Long lateSubmissionCount;
        @JsonProperty("lowest_score")
        private Object lowestScore;
        @JsonProperty("module_id")
      //  private Long moduleId;
        private Long moduleId;
        @JsonProperty("non_submit_times")
        private Object nonSubmitTimes;
        @JsonProperty("prerequisites")
        private List<PrerequisitesDTO> prerequisites;
        @JsonProperty("rubric_id")
        private Long rubricId;
        @JsonProperty("rubric_instance")
        private RubricInstanceDTO rubricInstance;
        @JsonProperty("rubric_instance_id")
        private Long rubricInstanceId;
        @JsonProperty("score_percentage")
       // private Object scorePercentage;
        private Object scorePercentage;
        @JsonProperty("score_published")
        private Object scorePublished;
        @JsonProperty("sort")
        private Long sort;
        @JsonProperty("start_time")
        private String startTime;
        @JsonProperty("submission_closed")
        private Boolean submissionClosed;
        @JsonProperty("submit_by_group")
        private Boolean submitByGroup;
        @JsonProperty("submit_times")
        private Object submitTimes;
        @JsonProperty("syllabus_id")
       // private Long syllabusId;
        private Long syllabusId;
        @JsonProperty("teaching_unit_id")
      //  private Long teachingUnitId;
        private Long teachingUnitId;
        @JsonProperty("title")
        private String title;
        @JsonProperty("type")
        private String type;
        @JsonProperty("unique_key")
        private String uniqueKey;
        @JsonProperty("updated_at")
        private String updatedAt;
        @JsonProperty("uploads")
        private List<UploadsDTO> uploads;

        @NoArgsConstructor
        @Data
        public static class CreatedByDTO {
            @JsonProperty("id")
          //  private Long id;
            private Long id;
            @JsonProperty("name")
            private String name;
        }

        @NoArgsConstructor
        @Data
        public static class DataDTO {
            @JsonProperty("allow_download")
            private Boolean allowDownload;
            @JsonProperty("allow_forward_seeking")
            private Boolean allowForwardSeeking;
            @JsonProperty("announce_score_time")
            private Object announceScoreTime;
            @JsonProperty("announce_score_type")
            private Long announceScoreType;
            @JsonProperty("description")
            private String description;
            @JsonProperty("is_scored")
            private Boolean isScored;
            @JsonProperty("mbz_module_id")
            private String mbzModuleId;
            @JsonProperty("pause_when_leaving_window")
            private Boolean pauseWhenLeavingWindow;
            @JsonProperty("score_percentage")
          //  private Long scorePercentage;
            private Object scorePercentage;
        }

        @NoArgsConstructor
        @Data
        public static class InterScoreMapDTO {
            @JsonProperty("end_time")
            private Object endTime;
            @JsonProperty("id")
            private Long id;
            @JsonProperty("is_closed")
            private Object isClosed;
            @JsonProperty("is_started")
            private Object isStarted;
            @JsonProperty("pieces_cnt")
            private Long piecesCnt;
            @JsonProperty("start_time")
            private Object startTime;
        }

        @NoArgsConstructor
        @Data
        public static class IntraRubricInstanceDTO {
            @JsonProperty("conditions")
            private Object conditions;
            @JsonProperty("id")
            private Long id;
            @JsonProperty("name")
            private Object name;
            @JsonProperty("rubric")
            private RubricDTO rubric;

            @NoArgsConstructor
            @Data
            public static class RubricDTO {
                @JsonProperty("conditions")
                private Object conditions;
                @JsonProperty("created_at")
                private Object createdAt;
                @JsonProperty("created_by")
                private CreatedByDTO createdBy;
                @JsonProperty("engage_number")
                private Long engageNumber;
                @JsonProperty("id")
                private Long id;
                @JsonProperty("name")
                private Object name;
                @JsonProperty("updated_at")
                private Object updatedAt;

                @NoArgsConstructor
                @Data
                public static class CreatedByDTO {
                    @JsonProperty("id")
                    private Long id;
                    @JsonProperty("name")
                    private Object name;
                }
            }
        }

        @NoArgsConstructor
        @Data
        public static class IntraScoreMapDTO {
            @JsonProperty("end_time")
            private Object endTime;
            @JsonProperty("id")
            private Long id;
            @JsonProperty("is_closed")
            private Object isClosed;
            @JsonProperty("start_time")
            private Object startTime;
        }

        @NoArgsConstructor
        @Data
        public static class RubricInstanceDTO {
            @JsonProperty("conditions")
            private Object conditions;
            @JsonProperty("id")
            private Long id;
            @JsonProperty("name")
            private Object name;
            @JsonProperty("rubric")
            private RubricDTO rubric;

            @NoArgsConstructor
            @Data
            public static class RubricDTO {
                @JsonProperty("conditions")
                private Object conditions;
                @JsonProperty("created_at")
                private Object createdAt;
                @JsonProperty("created_by")
                private CreatedByDTO createdBy;
                @JsonProperty("engage_number")
                private Long engageNumber;
                @JsonProperty("id")
                private Long id;
                @JsonProperty("name")
                private Object name;
                @JsonProperty("updated_at")
                private Object updatedAt;

                @NoArgsConstructor
                @Data
                public static class CreatedByDTO {
                    @JsonProperty("id")
                    private Long id;
                    @JsonProperty("name")
                    private Object name;
                }
            }
        }

        @NoArgsConstructor
        @Data
        public static class PrerequisitesDTO {
            @JsonProperty("activity_id")
            private Long activityId;
            @JsonProperty("activity_type")
            private String activityType;
            @JsonProperty("completion_criterion")
            private CompletionCriterionDTO completionCriterion;
            @JsonProperty("key")
            private String key;
            @JsonProperty("title")
            private String title;

            @NoArgsConstructor
            @Data
            public static class CompletionCriterionDTO {
                @JsonProperty("completion_info")
                private String completionInfo;
                @JsonProperty("completion_key")
                private String completionKey;
                @JsonProperty("completion_value")
                private String completionValue;
                @JsonProperty("criterion_key")
                private String criterionKey;
                @JsonProperty("criterion_text")
                private String criterionText;
                @JsonProperty("criterion_value")
                private Long criterionValue;
                @JsonProperty("has_completed")
                private Boolean hasCompleted;
            }
        }

        @NoArgsConstructor
        @Data
        public static class UploadsDTO {
            @JsonProperty("allow_download")
            private Boolean allowDownload;
            @JsonProperty("audio")
            private Object audio;
            @JsonProperty("created_at")
            private String createdAt;
            @JsonProperty("created_by_id")
            private Long createdById;
            @JsonProperty("deleted")
            private Boolean deleted;
            @JsonProperty("id")
            private Long id;
            @JsonProperty("is_cc_video")
            private Boolean isCcVideo;
            @JsonProperty("key")
            private String key;
            @JsonProperty("link")
            private Object link;
            @JsonProperty("name")
            private String name;
            @JsonProperty("origin_allow_download")
            private Boolean originAllowDownload;
            @JsonProperty("owner_id")
            private Long ownerId;
            @JsonProperty("reference_id")
            private Long referenceId;
            @JsonProperty("referenced_at")
            private String referencedAt;
            @JsonProperty("scorm")
            private Object scorm;
            @JsonProperty("size")
            private Long size;
            @JsonProperty("source")
            private String source;
            @JsonProperty("status")
            private String status;
            @JsonProperty("third_part_referrer_id")
            private Long thirdPartReferrerId;
            @JsonProperty("thumbnail")
            private Object thumbnail;
            @JsonProperty("type")
            private String type;
            @JsonProperty("updated_at")
            private String updatedAt;
            @JsonProperty("video_src_type")
            private String videoSrcType;
            @JsonProperty("videos")
            private List<VideosDTO> videos;

            @NoArgsConstructor
            @Data
            public static class VideosDTO  implements Comparable<VideosDTO>{
                // 视频的长度
                @JsonProperty("duration")
                private Double duration;
                @JsonProperty("id")
                // FIXME 这个不是视频的ID！！！！！！！！！
                private Long id;
                @JsonProperty("resolution")
                // 视频的清晰度？
                private String resolution;

                @Override
                public int compareTo(@NotNull VideosDTO o) {
                //    return Integer.compare(this.id,o.id);
                    return Long.compare(this.id,o.id);
                  //  return Integer.compare(o.id,this.id);
                }
            }
        }
    }
}
